package com.myidis.mapper;

import com.myidis.entity.*;
import com.myidis.request.SearchReq;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;

public interface SignalIndexResultMapper {
    @Select("SELECT * FROM signalindex_result_list}")
    @Results({
            @Result(property = "id", column = "id"),
            @Result(property = "subject", column = "subject"),
            @Result(property = "calTime", column = "calTime"),
            @Result(property = "combination", column = "combination"),
            @Result(property = "springDay", column = "springDay"),
            @Result(property = "calculator", column = "calculator"),
            @Result(property = "startTime", column = "startTime"),
            @Result(property = "endTime", column = "endTime")

    })
    ArrayList<IndexResultList> list();



    @Select("SELECT * FROM signalindex_result where listId = #{id}")
    @Results({
            @Result(property = "id", column = "id"),
            @Result(property = "listId", column = "listId"),
            @Result(property = "time", column = "time"),
            @Result(property = "combination", column = "combination"),
            @Result(property = "index", column = "index")
    })
    ArrayList<FullSIResult> getData(IndexResultList sea);

    @Select("SELECT * FROM signalindex_result_list where id = #{id}")
    @Results({
            @Result(property = "id", column = "id"),
            @Result(property = "subject", column = "subject"),
            @Result(property = "calTime", column = "calTime"),
            @Result(property = "combination", column = "combination"),
            @Result(property = "springDay", column = "springDay"),
            @Result(property = "calculator", column = "calculator"),
            @Result(property = "startTime", column = "startTime"),
            @Result(property = "endTime", column = "endTime")

    })
    FullSIResult getInfo(int sea);

    @Insert("INSERT intO signalindex_result(listId, time, index) VALUES( #{subject}, #{time}, #{index})")
    int insertDetail(FullSIResult set);

    @Insert("INSERT intO signalindex_result_list(subject, springDay, calTime, combination, calculator, startTime, endTime) VALUES(" +
            " #{subject},#{springDay}, #{calTime}, #{combination}, #{calculator}, #{startTime}, #{endTime})")
    int insertList(IndexResultList set);

    @Delete("DELETE FROM signalindex_result WHERE listId = #{id}")
    int deleteData(int id);

    @Delete("DELETE FROM signalindex_result_list WHERE id = #{id}")
    int delete(int id);
}
